<!--
 * @Author: your name
 * @Date: 2021-10-19 15:51:14
 * @LastEditTime: 2021-10-19 18:21:09
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \Vuec:\Users\86131\Desktop\project\payforknowledge\src\views\electronicBook.vue
-->
<!-- 电子阅读详情页 -->
<template>
  <div>
    <!-- 导航栏 -->
    <van-nav-bar
      title="电子书"
      left-text=""
      left-arrow
      :border="false"
      :fixed="true"
      @click="onClickBook"
    >
      <template #right>
        <van-icon name="shrink" size="18" />
      </template>
    </van-nav-bar>
    <!-- 介绍信息文字 -->
    <div class="text">
      <div class="text-top">
        <p>{{ detailList[0]?.introduce }}</p>
        <span>版权信息</span>
      </div>
      <div class="text-bot">
        <p>书名 ：{{ detailList[0]?.introduce }}</p>
        <p>作者 ： {{ detailList[0]?.name }}</p>
        <p>出版社 ： {{ detailList[0]?.position }}</p>
        <p>出版时间 ： {{ detailList[0]?.motto }}</p>
        <p>ISBN ： 8980987389390</p>
        <p>字数 ： {{ detailList[0]?.pages }}千字</p>
        <p>
          本书由{{ detailList[0]?.position }}有限公司授权，本App电子版制作与发行
        </p>
        <p>版权左右 侵权必究</p>
      </div>
    </div>
    <!-- 序 -->
    <div class="xu">
      <div class="xu-top">
        <p>序</p>
      </div>
      <div class="xu-bot">
        <p>
          {{ detailList[0]?.highlights }}
        </p>
        <p class="xu-set"></p>
      </div>
    </div>
    <!-- 评论框 -->
    <div class="plk">
      <div>
        <input type="text" placeholder="请输入评论内容" />
      </div>
      <div class="plk-icon">
        <div class="icon-left">
          <img src="../../src/assets/img/chakan.png" alt="" />
        </div>
        <div class="icon-right">
          <img src="../../src/assets/img/dianzan.png" alt="" />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { useRoute, useRouter } from "vue-router";
import { NavBar, Icon } from "vant";
import { ref } from "vue";
export default {
  setup() {
    const route = useRoute();
    const router = useRouter();
    let detailList = ref([]);
    const getdetail = () => {
      let id = route.query.id;
      fetch("http://1.116.189.101:3000/api/getdetail", {
        method: "post",
        headers: {
          "Content-Type": "application/x-www-form-urlencoded",
        },
        body: `id=${id}`,
      })
        .then((response) => response.json())
        .then((res) => {
          if (res.status === 0) {
            detailList.value = res.result;
            console.log(detailList.value);
          }
        });
    };
    getdetail();
    const onClickBook = () => {
      router.go(-1);
    };
    return {
      onClickBook,
      detailList,
    };
  },

  components: {
    VanNavBar: NavBar,
    VanIcon: Icon,
  },

  computed: {},

  mounted() {},

  methods: {},
};
</script>

<style lang="less" scoped>
/deep/ .van-nav-bar .van-icon {
  font-size: 24px;
  color: #424242;
}
/deep/ .van-icon-shrink:before {
  font-size: 24px;
  color: #424242;
}
/deep/ .van-nav-bar__title {
  font-size: 18px;
}
// 介绍信息文字
.text {
  background: #fff;
  padding: 10px 5px 10px 10px;
  margin-top: 46px;
  .text-top {
    p {
      font-size: 28px;
      font-weight: bold;
      letter-spacing: 1px;
    }
    span {
      font-size: 20px;
      font-weight: bold;
      text-align: center;
      display: block;
      margin: 20px 0;
    }
  }
  .text-bot {
    p {
      font-size: 16px;
      line-height: 25px;
    }
  }
}
// 序
.xu {
  background: #fff;
  padding: 15px 10px 0 10px;
  .xu-top {
    padding-bottom: 15px;
    p {
      font-size: 20px;
      font-weight: bold;
      text-align: center;
    }
  }
  .xu-bot {
    p {
      font-size: 16px;
      text-indent: 2em;
      line-height: 25px;
      letter-spacing: 1px;
      text-align: justify; //两端对齐
    }
    .xu-set {
      padding-bottom: 71px;
    }
  }
}
// 评论框
.plk {
  background: #fff;
  padding-left: 10px;
  display: flex;
  justify-content: space-between;
  padding-bottom: 30px;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  input {
    width: 250px;
    height: 32px;
    border-radius: 20px;
    // border: 1px solid red;
    border: 0;
    background: #ededed;
    font-size: 16px;
    padding-left: 15px;
    &::placeholder {
      font-size: 14px;
      color: #9e9e9e;
      font-weight: bold;
      position: relative;
      top: 0px;
      left: 10px;
    }
  }
  .plk-icon {
    display: flex;
    justify-content: space-between;
    flex: 1;
    padding: 0 12px 0 30px;
    .icon-left {
      img {
        width: 20px;
        height: 20px;
      }
    }
    .icon-right {
      img {
        width: 20px;
        height: 20px;
      }
    }
  }
}
</style>
